<!DOCTYPE html>
<html>
<head>
	{include file="common_header" /}
	{include file="common_top" /}
</head>
<body>

  <div class="layui-fluid">
    <div class="layui-card">
      <div class="layui-card-header">系统设置</div>
      <div class="layui-card-body" style="padding: 15px;">
        <form class="layui-form" action="" lay-filter="component-form-group">

          
          <div class="layui-form-item">
            <label class="layui-form-label">网站名称</label>
            <div class="layui-input-block">
              <input type="text" name="s_webtitle" id="s_webtitle"   placeholder="网站名称" value="{$config['s_webtitle']}" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">网站域名</label>
            <div class="layui-input-block">
              <input type="text" name="s_domain" id="s_domain"   placeholder="网站域名，不必填写http或https" value="{$config['s_domain']}" class="layui-input">
            </div>
          </div>

		  
		  <div class="layui-form-item">
            <label class="layui-form-label">版权信息</label>
            <div class="layui-input-block">
              <input type="text" name="s_copyright" id="s_copyright"   placeholder="版权信息" value="{$config['s_copyright']}" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">积分比例</label>
            <div class="layui-input-block">
              <input type="text" name="s_credit" id="s_credit"   placeholder="充值积分对换比例例充值1元为1个积分" value="{$config['s_credit']}" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">短信功能</label>
            <div class="layui-input-block">
              <input type="radio" name="s_smsswitch" value="1" title="启用" {if $config['s_smsswitch']==1}checked=""{/if}>
              <input type="radio" name="s_smsswitch" value="2" title="禁用" {if $config['s_smsswitch']==2}checked=""{/if}>
            </div>
          </div>
		  
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">短信帐号</label>
            <div class="layui-input-block">
              <input type="text" name="s_smsusername" id="s_smsusername"   placeholder="短信平台帐号" value="{$config['s_smsusername']}" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">短信密码</label>
            <div class="layui-input-block">
              <input type="text" name="s_smspassword" id="s_smspassword"   placeholder="短信平台密码" value="{$config['s_smspassword']}" class="layui-input">
            </div>
          </div>
		  
		<div class="layui-form-item">
            <label class="layui-form-label">用户默认群组</label>
            <div class="layui-input-block">
              <select name="ugid" id="ugid">
				{volist name="group" id="vo"}
                <option value="{$vo.ug_id}" {if $config['ug_id']==$vo.ug_id}selected="selected"{/if}>{$vo.ug_title}</option>
				{/volist}
              </select>
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">快捷金额</label>
            <div class="layui-input-block">
              <input type="text" name="s_fastmoney" id="s_fastmoney"   placeholder="例10|20|30" value="{$config['s_fastmoney']}" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">直推拥金</label>
            <div class="layui-input-block">
              <input type="text" name="s_commission_one" id="s_commission_one"   placeholder="直推拥金" value="{$config['s_commission_one']}" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">二级拥金</label>
            <div class="layui-input-block">
              <input type="text" name="s_commission_two" id="s_commission_two"   placeholder="二级拥金" value="{$config['s_commission_two']}" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">三级拥金</label>
            <div class="layui-input-block">
              <input type="text" name="s_commission_three" id="s_commission_three"   placeholder="三级拥金" value="{$config['s_commission_three']}" class="layui-input">
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">最少提现金额</label>
            <div class="layui-input-block">
              <input type="text" name="s_tixian_min" id="s_tixian_min"   placeholder="最少提现金额" value="{$config['s_tixian_min']}" class="layui-input">
            </div>
          </div>
		
          <div class="layui-form-item">
            <label class="layui-form-label">银行卡提现</label>
            <div class="layui-input-block">
              <input type="radio" name="bank" value="1" title="启用" {if $config['s_tongdao_bank']==1}checked=""{/if}>
              <input type="radio" name="bank" value="2" title="禁用" {if $config['s_tongdao_bank']==2}checked=""{/if}>
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">微信提现</label>
            <div class="layui-input-block">
              <input type="radio" name="wx" value="1" title="启用" {if $config['s_tongdao_wx']==1}checked=""{/if}>
              <input type="radio" name="wx" value="2" title="禁用" {if $config['s_tongdao_wx']==2}checked=""{/if}>
            </div>
          </div>
		  
		  <div class="layui-form-item">
            <label class="layui-form-label">支付宝提现</label>
            <div class="layui-input-block">
              <input type="radio" name="zfb" value="1" title="启用" {if $config['s_tongdao_zfb']==1}checked=""{/if}>
              <input type="radio" name="zfb" value="2" title="禁用" {if $config['s_tongdao_zfb']==2}checked=""{/if}>
            </div>
          </div>
		  
          <div class="layui-form-item layui-layout-admin">
            <div class="layui-input-block">
              <div class="layui-footer" style="left: 0;">
                <div class="layui-btn sub">立即提交</div>
                <button type="reset" class="layui-btn layui-btn-primary ">重置</button>
              </div>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
{include file="common_footer" /} 
<script>
$(".sub").click(function(){
	//if(!$(".btn").hasClass("sub")){return false;}
	var ugid        = $("#ugid").val();
	var s_webtitle  = $("#s_webtitle").val();
	var s_domain  = $("#s_domain").val();
	var s_copyright  = $("#s_copyright").val();
	var s_credit  = $("#s_credit").val();
	var s_smsusername  = $("#s_smsusername").val();
	var s_smspassword  = $("#s_smspassword").val();
	var s_fastmoney  = $("#s_fastmoney").val();
	var s_commission_one  = $("#s_commission_one").val();
	var s_commission_two  = $("#s_commission_two").val();
	var s_commission_three  = $("#s_commission_three").val();
	var s_tixian_min  = $("#s_tixian_min").val();
	var s_smsswitch = $("input[name='s_smsswitch']:checked").val();
	var bank = $("input[name='bank']:checked").val();
	var wx = $("input[name='wx']:checked").val();
	var zfb = $("input[name='zfb']:checked").val();
	

	if(s_webtitle == ""){
		show_error("网站名称不能为空！");
		return false
	}
	
	if(s_credit == ""){
		show_error("积分比例不能为空！");
		return false
	}
	
	if(s_fastmoney == ""){
		show_error("快捷金额不能为空！");
		return false
	}
	
	
	if(s_commission_one == ""){
		show_error("直推拥金不能为空！");
		return false
	}
	
	if(s_commission_two == ""){
		show_error("二级拥金不能为空！");
		return false
	}
	
	if(s_commission_three == ""){
		show_error("三级拥金不能为空！");
		return false
	}
	
	if(s_tixian_min == ""){
		show_error("最少提现金额不能为空！");
		return false
	}
	

	
	$.ajax({
		type:"POST",
		url:"{:url('setup/system')}",
		dataType:"json",
		data:{
			 ugid:ugid,
			 s_webtitle:s_webtitle,
			 s_domain:s_domain,
			 s_copyright:s_copyright,
			 s_credit:s_credit,
			 s_smsusername:s_smsusername,
			 s_smspassword:s_smspassword,
			 s_fastmoney:s_fastmoney,
			 s_commission_one:s_commission_one,
			 s_commission_two:s_commission_two,
			 s_commission_three:s_commission_three,
			 s_tixian_min:s_tixian_min,
			 s_smsswitch:s_smsswitch,
			 bank:bank,
			 wx:wx,
			 zfb:zfb,
		},

		success:function(res){
			if(res.status == "success"){
				show_toast_callurl(res.data,"{:url('setup/system')}","success");
			}else{
				show_error(res.data);
			}
		},
		error:function(jqXHR){
			console.log("Error: "+jqXHR.status);
		},
	});
	
});
</script>
</body>
</html>
